<style>
    .overLoading {
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: #f5f5f5;
        opacity:0.5;
        z-index: 1000;
    }
    .layoutLoading {
        display: none;
        position: absolute;
        top: 40%;
        left: 40%;
        width: 20%;
        height: 20%;
        z-index: 1001;
        text-align:center;
    }
</style>
<div class="x-body">
<form class="layui-form">



            <div class="layui-form-item">
                <label for="number" class="layui-form-label">
                    <span class="x-red">*</span>新增钱包地址个数
                </label>
                <div class="layui-input-block">
                    <input type="text" id="number" name="number" required="" lay-verify="required"
                           autocomplete="off"   class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                    (新增钱包地址个数)
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>地址类型
                </label>
                <div class="layui-input-block">

                    <select name="type">
                        <option value="0" selected="selected">会员注册</option>
                        <option value="1" >模板数据</option>
                    </select>

                </div>
                <div class="layui-form-mid layui-word-aux">
                    (数据使用类型)
                </div>

            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>币种分类
                </label>
                <div class="layui-input-block">

                    <select name="mid">
                        {volist name='wallet' id='vo'}
                        <option value="{$vo['id']}" {notempty name="info['mid']"}{if condition="$info['mid'] eq $vo['id']"} selected="selected" {/if}{/notempty} >{$vo['name']}</option>

                        {/volist}
                        <option value="6" >ETH</option>
                    </select>

                </div>
                <div class="layui-form-mid layui-word-aux">
                    (币种分类)
                </div>

            </div>

          <div id="over" class="overLoading"></div>
          <div id="layout" class="layoutLoading"><img src="__STATIC__/module/admin/img/loading.gif" /></div>



          <button type="button"  class="layui-btn ladda-button" onclick="add(1)">
              确 定
          </button>
          <a class="layui-btn ladda-button" onclick="javascript:history.back(-1);return false;"><i class="fa fa-history"></i> 返 回</a>



</form>
      </div>
<script>
    function  add(count) {

        var number=$("[name='number']").val();
        var mid=$("[name='mid']").val();
        var type=$("[name='type']").val();
        if(number>=1){
            document.getElementById("over").style.display = "block";
            document.getElementById("layout").style.display = "block";
            $(this).attr('disabled',true);
            $.post("{:url('wallet/wallet_address')}",{mid:mid,type:type},function (d) {

                if(d['code']==1){
                    count++;
                    if(count<=number){
                      setTimeout( add(count),1000);
                       
                    }else{
                        alert(d['msg']);
                        document.getElementById("over").style.display = "none";
                        document.getElementById("layout").style.display = "none";
                        $(this).attr('disabled',false);
                    }

                }else{
                    alert(d['msg']);
                    document.getElementById("over").style.display = "none";
                    document.getElementById("layout").style.display = "none";
                    $(this).attr('disabled',false);
                }
            });

        }else{
            return false;
        }
    }
</script>


